﻿#ifndef PUBLICSHARE_H
#define PUBLICSHARE_H

#include <QObject>
#include <QWidget>
#include <QScrollArea>
#include <QVariant>
#include <QVariantList>


#define Controller_Mill_Path "/../tplib/controller/mill"
#define Controller_Lathe_Path "/../tplib/controller/lathe"
#define Controller_Wedm_Path "/../tplib/controller/wedm"

#define Place_Formt_Str "Cur_Null_Obj_Name"

#define Key_Role_Name 0
#define Key_Role_Title 1
#define Key_Role_User_Data 2
#define Key_Role_Level 3



class PublicShared
{
public:
    PublicShared();

    static QString readFileStr(const QString &iFilePath);
    static bool writeFileStr(const QString &iFileName,const QString &iStr);

    static QVariant jsonStr2Variant(const QString &iStr);
    static QString variant2JsonStr(const QVariant &iValue);

    static void setStyle(const QString &styleFilePath);
};

//中间显示主要内容，两边留白，下方为btn
class QDialogButtonBox;
class QScrollArea;
class HoverCenterWgtAbs : public QWidget
{
    Q_OBJECT
public:
    HoverCenterWgtAbs(QVariantMap iDataMap,QWidget *iParent = nullptr);
    ~HoverCenterWgtAbs();

protected:
    virtual QVariant getData() = 0;
    virtual void setData(QVariant iValue) = 0;
    virtual void setCenterWgt(QWidget *iCenterWgt) = 0;
private:
    void initUi();

private:
    QScrollArea *mCerterArea = nullptr;
    QDialogButtonBox *mBtnsBox = nullptr;

    QVariantMap mDataMap = QVariantMap();
};

#endif // PUBLICSHARE_H
